<?php
/**
 * $Id: MtipomonedaTable.php 12 2010-07-06 04:34:57Z corlatti $
 * @author Claudio Corlatti
 *
 */
class MtipomonedaTable extends Doctrine_Table {
	public function getAll($onlyEnabledOnes=true, $orderBy){
		$result = null;
		try {
			//solves the orderby's null problem
			$defaultOrder = ' b.descripcion ';
			$orderBy = empty($orderBy) ? $defaultOrder : $orderBy;
			
			$q = $this->createQuery()
				->select(' b.* ')
				->from(' Mtipomoneda b ')
				->where(' 1=1 ');
			
			if($onlyEnabledOnes){
				$q->addWhere('b.habilitado=?', 1);
			}
				$q->addOrderBy( $orderBy )
				->setHydrationMode(Doctrine::HYDRATE_ARRAY);
				
			$result = $q;
		} catch(Exception $e){
			throw $e;
		}
		return $result;
	}
}
?>